<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript">
        var user = {
            "name": "张三",
            "age": "18",
            "sex": "男"
        };

        // js 对象 转换为 json 字符串
        let json = JSON.stringify(user);
        console.log(json);

        // json字符串 转换为 js对象
        let parse = JSON.parse(json);
        console.log(parse);

    </script>
</head>
<body>

</body>
</html>